﻿using Architecture.Repository.Interface.Traceability;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Traceability.Domain.Service.ShoppingNameService
{
    /// <summary>
    /// 商品名称信息服务
    /// </summary>
    public class ShoppingNameService : IShoppingNameService
    {
        /// <summary>
        /// 商品名称仓储
        /// </summary>
        protected readonly IShoppingNameRepository shoppingNameRepository;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="shoppingNameRepository">商品名称仓储</param>
        public ShoppingNameService(IShoppingNameRepository shoppingNameRepository)
        {
            this.shoppingNameRepository = shoppingNameRepository;
        }

        /// <summary>
        /// 添加商品名称
        /// </summary>
        /// <param name="shoppingName">商品名称实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> AddShoppingName(ShoppingName shoppingName)
        {
            return await shoppingNameRepository.AddAsync(shoppingName);
        }

        /// <summary>
        /// 获取商品名称列表
        /// </summary>
        /// <returns>返回商品名称列表信息</returns>
        public async Task<List<ShoppingName>> GetShoppingNameList()
        {
            return await shoppingNameRepository.GetAllAsync();  
        }
    }
}
